﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ebook_Organizer.Library
{
    class Catalogator
    {
        private static Dictionary<string, long> FindAuthor = new Dictionary<string, long>();

        public static void Clear()
        {
            FindAuthor.Clear();
        }
        public static void Add(string[] file)
        {
            for (int t = 0; t < file.Length; t++)
                if (FindAuthor.ContainsKey(file[t]))
                    FindAuthor[file[t]]++;
                else
                    FindAuthor.Add(file[t], 1);
        }

        public static void DisplayAuthor()
        {
            int cnt = FindAuthor.Count(p => p.Value > 1);
            foreach(KeyValuePair<string,long> author in FindAuthor.Where(p => p.Value > 1))
            {
                System.Diagnostics.Debug.WriteLine(string.Concat(author.Key, "\t", author.Value));
            }

        }
    }
}
